
package org.tps.project.controllers;


import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import Project.ejb1.entities.Agence;
import Project.ejb1.entities.Drh;
import Project.ejb1.entities.Mission;
import Project.ejb1.services.AgenceServiceLocal;
import Project.ejb1.services.DrhServiceLocal;
import Project.ejb1.services.MissionServiceLocal;

@ManagedBean
@SessionScoped
public class MissionRingIndexController {
	@EJB
	private AgenceServiceLocal agenceService;
	
	@SuppressWarnings("unused")
	private List<Agence>agences= new ArrayList<Agence>();
	
	@EJB
	private MissionServiceLocal missionService;

	private Mission mission;
	
	private Agence selectedAgence;
	
	@EJB
	private DrhServiceLocal drhService;

	private Drh drh;
	
	public void selectAgence(Agence agence) {
		selectedAgence = agence;
	}
	
	public List<Agence> getAgences() {
		return (List<Agence>) agenceService.findAll();
	}

	public void setAgences(List<Agence> agences) {
		this.agences = agences;
	}

	public MissionRingIndexController() {
		   
	}

	public Agence getSelectedAgence() {
		return selectedAgence;
	}

	public void showDetails(Agence agence) {
		selectedAgence=agence;
		mission = missionService.findById(agence.getCurrentMissionID());
		drh = drhService.findById(mission.getDrhID());
		
	}
	
	public void setSelectedAgence(Agence selectedAgence) {
		this.selectedAgence = selectedAgence;
	}

	public Mission getMission() {
		return mission;
	}

	public void setMission(Mission mission) {
		this.mission = mission;
	}

	public Drh getDrh() {
		return drh;
	}

	public void setDrh(Drh drh) {
		this.drh = drh;
	}

}
